// ml:run = $bin < input
#include <iostream>
#include <algorithm>
#include <vector>

int const maxn = 100007;
int depth[maxn];
int father[maxn];
int num[maxn], back[maxn];
int n, m;

std::vector<std::vector<int>> tree;

void add_edge(int u, int v)
{
    tree[u].push_back(v);
    tree[v].push_back(u);
}

void init()
{
    tree.clear();
    tree.resize(n + 1);
}

void dfs(int u, int d, int f)
{
    depth[u] = d;
    father[u] = f;
    num[u] = 0;
    for (auto v : tree[u]) {
        if (f == v) continue;
        num[u]++;
        dfs(v, d + 1, u);
    }
    back[u] = num[u];
}

int main()
{
    std::ios_base::sync_with_stdio(false);
    int T; std::cin >> T;
    for (int ti = 1; ti <= T; ti++) {
        std::cout << "Case #" << ti << ":\n";
        std::cin >> n >> m;
        init();
        for (int i = 1, x, y; i < n; i++) {
            std::cin >> x >> y;
            add_edge(x, y);
        }

        dfs(1, 0, 0);

        for (int i = 0, t; i < m; i++) {
            std::cin >> t;
            std::vector<int> v(t);
            for (int j = 0; j < t; j++) std::cin >> v[j];
            std::sort(v.begin(), v.end(), [](int a, int b) {
                        return depth[a] > depth[b];
                    });

            int ans = n - t;
            for (auto u : v) {
                if (num[u] == 0) {
                    num[father[u]]--;
                } else if (num[u] == 1) {
                    //
                } else {
                    ans++;
                }
            }

            std::cout << ans << "\n";

            for (auto u : v) {
                num[father[u]] = back[father[u]];
            }
        }
    }
}

